<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>

  <body></body>
</html>
<script src="./js/YPromise.js"></script>
<script>
  const a = new YPromise((resolve, reject) => {
    reject(111)
  })
  a.then(
    (res) => {
      console.log("res", res)
    },
    (err) => {
      console.log("err", err)
      return new YPromise((resolve, reject) => {
        resolve(222)
      })
    }
  ).then(
    (res) => {
      console.log("res2", res)
    },
    (err) => {
      console.log("err2", err)
    }
  )
  console.log(a)
</script>
